home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
mouse.exe
/
MOUSE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-06-02
|
42KB
|
1,015 lines
{$O-,R-,I-,V-,F+}
Unit Mouse;
{$UNDEF GMouse}
{$DEFINE GMouse} {<-- if you are not using graphics remove this definition}
{***************************************************************************}
{* Mouse - Turbo Pascal Mouse Unit Version 3.1 *}
{* by Michael Day 05/28/89 *}
{* *}
{* Based on the Mouse4 unit developed by Richard Sadowsky 11/20/87 *}
{* Graphics cursor procedure borrowed from EgaMouse *}
{* by Eduardo Martins 02/02/88 *}
{* *}
{* This program is released to the public domain *}
{* *}
{* This program assumes that you have a MS (or compatible) *}
{* mouse driver installed on the computer. *}
{* *}
{***************************************************************************}
{ History }
{ V2.0 First release under this package unkown date -med}
{ V2.1 as of 09/10/88 First full release of this package -med}
{ V2.2 as of 09/15/88 Corrected Graphic cursor bug in V2.1 which had }
{ incorrect tables for some cursors. Also improved the table structure }
{ at the same time. -med }
{ V2.3 as of 09/28/88 Corrected bug in release V2.2 to fix mouse detect }
{ crash when running under DOS 2.x. -med }
{ V2.4 as of 04/08/89 fixed checkmark cursor and circle target cursor -med}
{ V3.0 as of 05/23/89 added BGI mouse emulation for EGA debugging -med}
{ V3.1 as of 05/29/89 added Hercules page control fix BGI mouse cursor}
{ to deal with BGI screen edge problem (redraws mouse at edge). -med}
{***************************************************************************}
Interface
{$IFDEF GMouse}
Uses DOS,Graph{,crt};
{$ELSE}
Uses DOS;
{$ENDIF}
{---------------------------------------------------------------------------}
{Externally accessable constants}
const
MouseLeftButton = 1; {what the buttons are}
MouseRightButton = 2;
MouseCenterButton = 4;
MouseStandard = 1; {graphic cursor definitions}
MouseUpArrow = 2;
MouseDownArrow = 3;
MouseLeftArrow = 4;
MouseRightArrow = 5;
MouseCheckMark = 6;
MouseUpHand = 7;
MouseDownHand = 8;
MouseLeftHand = 9;
MouseRightHand = 10;
MouseStopHand = 11;
MouseHourGlass = 12;
MouseDiagCross = 13;
MouseRectCross = 14;
MouseRectBox = 15;
MouseTargetCross = 16;
MouseTargetCircle = 17;
MouseTargetBox = 18;
MouseQuestionMark = 19;
MaxMouseGraphShape = 19;
MaxMouseTextShape = 15;
{---------------------------------------------------------------------------}
{Externally accessable variables}
var CrtMode : Byte absolute $40:$49; {BIOS Crt mode flag byte}
CrtCols : Word absolute $40:$4A; {BIOS Crt column count}
CrtRows : Byte absolute $40:$84; {BIOS Crt row count}
SysClk : Word absolute $40:$6C; {BIOS system clock counter}
CursorMode : Word absolute $40:$60; {BIOS cursor mode storage}
var
MouseInstalled : Boolean; {InitMouse - True if mouse is operable}
MouseError : Integer; {InitMouse - Error code}
MouseType : Integer; {InitMouse - Mouse Type}
MouseClicked : Boolean; {ReadMouse - True if button was clicked}
MouseButtons : Word; {ReadMouse - Current mouse button status}
MouseClickButton : Word; {ReadMouse - Click button status}
MouseX : Integer; {ReadMouse - Mouse X Position}
MouseY : Integer; {ReadMouse - Mouse Y Position}
ClickMouseX : Integer; {ReadMouse - Mouse X Click Position}
ClickMouseY : Integer; {ReadMouse - Mouse Y Click Position}
MousePressX : Integer; {last mouse button press position}
MousePressY : Integer;
MouseReleaseX : Integer; {last mouse button release position}
MouseReleaseY : Integer;
MouseHideX1 : Integer;
MouseHideY1 : Integer; {HideMouseArea - Mouse hide area}
MouseHideX2 : Integer;
MouseHideY2 : Integer;
MouseAreaX1 : Integer; {SetMouseArea - Mouse bounded area}
MouseAreaY1 : Integer;
MouseAreaX2 : Integer;
MouseAreaY2 : Integer;
const
MouseGShape : Integer = 1; {selected graphic mouse shape}
MouseTShape : Integer = 0; {selected text mouse shape}
MouseState : Integer = -1; {Negative = mouse hidden}
MouseVisible : Boolean = false; {true = mouse is visible}
MouseCondo : Boolean = false; {true = conditional mouse hiding}
MouseReDraw : Boolean = false; {true = mouse needs to be redrawn}
MouseHooked : Boolean = false; {true = mouse hooked to clock int}
TextMouse : Boolean = false; {true = text mode type mouse}
ZeroMouse : Boolean = false; {true = text mouse starts at 0}
HercGraphMouse : Boolean = false; {true = Herc graph mode mouse}
MouseTextWidth : Word = 8; {size of text on screen for mouse}
MouseTextHeight : Word = 8;
MaxCrtX : Word = 80; {screen size in characters}
MaxCrtY : Word = 25;
MouseColor : Word = $FFFF; {mouse cursor color}
UseMouseSim : Boolean = false; {true = use simulated mouse cursor}
MouseImageX : Integer = 0; {current mouse XY image position}
MouseImageY : Integer = 0;
{---------------------------------------------------------------------------}
type MaskType = record {mouse graphic cursor definition}
Def: array [0..1, 0..15] of word; {graphics cursor def}
HotX, HotY: integer; { hot spot X,Y }
end;
{ define what the mouse text cursor definition array looks like }
type MouseTextType = record
Select : Word;
Start : Word;
Stop : Word;
end;
{---------------------------------------------------------------------------}
{Note: You must set the MouseTextWidth and MouseTextHeight values}
{to the current character pixel width and height to properly use the}
{mouse text X,Y coordinate system. Startup Default is 8x8.}
{To start up the mouse you should do the following: }
{InitMouse; ReadMouse; ShowMouse; - This insures that the mouse is}
{properly setup and ready to run. Additionally, if you have a Hercules}
{display, you must call SetHercPage prior to calling InitMouse to properly}
{initialize the mouse driver for the Hercules display.}
{For more information on the mouse interface and programming with }
{with a mouse refer to the MicroSoft Mouse Programmer's Reference Guide}
{Available from MicroSoft Corporation.}
{Warning: All mouse drivers are not created equal. Nor are programs that }
{use them. Be especially careful with the MouseAreaHide function, if you }
{are using an EGA display with Turbo Pascal it will not work. The area }
{hide function requires that certain EGA display calls be performed through }
{an extended video BIOS call so that it can know what to expect in how the }
{display is setup. Since Turbo Pascal does not do this, The MouseAreaHide }
{function will not currently work under Turbo Pascal. With other displays }
{you shouldn't have a problem. Also be aware that some mouse drivers do not }
{impliment all functions exactly the same, and that the early MS mouse driver}
{did not impliment all the functions listed here. If you have any questions}
{check with your mouse m